package ch.rheintalconnection.sysventory.foundation;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

public class ParseUtility {

	private static Logger logger = LogManager.getLogger(ParseUtility.class);

	public static long tryParseLong(String s) {

		long l = -1;

		try {
			l = Long.parseLong(s);
		} catch (NumberFormatException e) {

			log(s);
		}

		return l;
	}

	public static int tryParseInt(String s) {

		int i = -1;

		try {
			i = Integer.parseInt(s);
		} catch (NumberFormatException e) {

			log(s);
		}

		return i;
	}
	
	private static void log(String s) {
		logger.warn("Wert konnte nicht geparst werden :" + s);
	}

}
